cpupool: prevent a domain from moving itself
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Tue, 23 Apr 2013 09:48:11 +0000 (11:48 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 23 Apr 2013 09:48:11 +0000 (11:48 +0200)
In the XEN_SYSCTL_CPUPOOL_OP_MOVEDOMAIN operation, the existing check
for domid == 0 should be checking that a domain does not attempt to
modify its own cpupool; fix this by using rcu_lock_remote_domain_by_id.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
xen/common/cpupool.c

index 2aaa48610cc88c4d59ed89d157176b730372ca19..2164a9fc7268ab2d15e7cb9ebdc5b470c4717f7b 100644 (file)
@@ -576,12 +576,8 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op)
     {
         struct domain *d;
 
-        ret = -EINVAL;
-        if ( op->domid == 0 )
-            break;
-        ret = -ESRCH;
-        d = rcu_lock_domain_by_id(op->domid);
-        if ( d == NULL )
+        ret = rcu_lock_remote_domain_by_id(op->domid, &d);
+        if ( ret )
             break;
         if ( d->cpupool == NULL )
         {